import { createRouter, createWebHistory } from 'vue-router';
import LoginView from '../views/login.vue';
import LogoutView from '../views/logout.vue';
import CallbackView from '../views/callback.vue';

const router = createRouter({
  history: createWebHistory(import.meta.env.MICRO_SITE_BASE_URL),
  routes: [
    {
      path: '/login',
      component: LoginView,
      props: route => ({
        from: route.query.from,
      }),
    },
    {
      path: '/logout',
      component: LogoutView,
      props: route => ({
        from: route.query.from,
      }),
    },
    {
      path: '/callback',
      component: CallbackView,
      props: route => ({
        code: route.query.code,
        from: route.query.from,
      }),
    },
  ],
})

export default router;
